<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">

        <!-- v-for用于渲染多个数据 等同于编程中的for循环 -->
        <h1 v-for="(add,i) of address" :key="i">
            地址为：{{i}} - {{add}}
        </h1>
        <hr>
        <table>
            <tr>
                <td>编号</td>
                <td>姓名</td>
                <td>年龄</td>
            </tr>
            <tr v-for="stu in students">
                <td>{{stu.id}}</td>
                <td>{{stu.name}}</td>
                <td>{{stu.age}}</td>
            </tr>
        </table>

        <span v-for="n in 100">
            <span v-if="n % 2 == 0">{{n}}</span>
        </span>

    </div>

</body>

</html>
<script>
    new Vue({
        el: '#app',
        data: {
            //数组
            address: ['大理', '丽江', '北京'],
            students: [
                { id: 1, name: '张三', age: 38 },
                { id: 2, name: '李四', age: 45 },
                { id: 3, name: '王五', age: 60 }
            ]
        }
    });
</script>